import axios from '@/libs/api.request'

export const listSpiderConfig = () => {
  return axios.request({
    url: 'web-spider-configs/',
    method: 'get'
  })
}

export const addSpiderConfig = (data) => {
  return axios.request({
    url: 'web-spider-configs/',
    method: 'post',
    data: data
  })
}

export const deleteSpiderConfig = (id) => {
  return axios.request({
    url: 'web-spider-configs/' + id + '/',
    method: 'delete'
  })
}

export const infoSpiderConfig = (id) => {
  return axios.request({
    url: 'web-spider-configs/' + id + '/',
    method: 'get'
  })
}

export const saveSpiderConfig = (id, data) => {
  return axios.request({
    url: 'web-spider-configs/' + id + '/',
    method: 'put',
    data: data
  })
}

export const scriptWebSpider = (data) => {
  return axios.request({
    url: 'script-web-spiders/',
    method: 'post',
    data: data
  })
}

export const getWebSpiderResult = (saveFolder) => {
  return axios.request({
    url: 'script-web-spiders/' + saveFolder + '/',
    method: 'get'
  })
}

export const isSpiderRuning = (saveFolder) => {
  return axios.request({
    url: 'spider-runings/' + saveFolder + '/',
    method: 'get'
  })
}
